package com.itheima.mapper;


import com.itheima.pojo.KsClass;
import com.itheima.pojo.Student;
import com.itheima.pojo.User;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @Entity generator.pojo.User
*/
public interface UserMapper {

    @Select("select * from user where mobile=#{mobile}")
    @ResultMap("BaseResultMap")
    User selectMobile(String mobile);

    @Select("select * from user where mobile=#{name}")
    @ResultMap("BaseResultMap")
    User selectByName(String name);
    @Select("select id,name,mobile,password,class_id,group_id,group_name,integral from user where role_id=2")
    @ResultMap("BaseResultMapStu")
    List<Student> selectByClassId();
    @Select("select id,name,mobile,password,class_id,group_id,group_name,integral from user where role_id=2 and id=#{id}")
    @ResultMap("BaseResultMapStu")
    Student selectByStudentId(Integer id);
    @Update("update user set integral=#{integral} where id=#{id}")
    int updateIntegral(Student student1);
}
